//只需要一个vuex的情况下
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const state = {
  data:2
}
const mutations = {
  add(state,param){//传递参数
    state.data+=param;
  },
  reduce(state){
    state.data--
  }
}
const actions = {
  add:({commit},param) => {commit('add',param)},//传递参数
  reduce:({commit}) => {commit('reduce')}
}

export default new Vuex.Store({state,mutations,actions})
